import Taro, { Component, Config } from '@tarojs/taro'
import { View, Text, Image, Button, ScrollView } from '@tarojs/components'
import Kefu from '../../components/kefu/kefu'
import HotService from './../../components/hot-service/hot-service.tsx'
import MainMenu from '../../components/main-menu/main-menu.tsx'
import Adv from '../../components/adv/adv.tsx'
import './index.scss'
import serviceApi from '../../service/api'
import mUser from '../../components/native/user'

export default class Index extends Component {

  /**
   * 指定config的类型声明为: Taro.Config
   *
   * 由于 typescript 对于 object 类型推导只能推出 Key 的基本类型
   * 对于像 navigationBarTextStyle: 'black' 这样的推导出的类型是 string
   * 提示和声明 navigationBarTextStyle: 'black' | 'white' 类型冲突, 需要显示声明类型
   */


  config: Config = {
    navigationBarTitleText: '快洁家政-杭州未来科技城'
  }

  componentWillMount () {
    serviceApi.get(this, 'menu/get_list'),
    mUser.login(this)
  }

  componentDidMount () { }

  componentWillUnmount () { }

  componentDidShow () { }

  componentDidHide () { }

  render () {
    return (
      <View>
          <View>
				<Adv system_ads={this.state.ad_banners}  />
          </View>
          <View>
            <View className="title1">
                <View className="title-big">家政服务</View>
                <View className="title-middle">家的清洁，我来守护</View>
            </View>
            <MainMenu main_menus={this.state.main_menus} />
            <View className="line1"></View>
            <View className="title1">
                <View className="title-big">热门服务</View>
                <View className="title-middle">您想要的，这里都有！</View>
                <HotService hot_services={this.state.hot_services} summary={this.state.summary} />
            </View>
            <View className="web-dev"></View> 
            <Kefu />
          </View>
      </View>
    )
  }
}
